Embodiments relate to an encoder, a decoder, a system comprising an encoder and a decoder, a method for encoding and a method for decoding. Some embodiments relate to apparatuses and methods for optimal residual quantization in source coding. Some embodiments relate to a source coding scheme using entropy coding to code a quantized signal on a determined number of bits.
Entropy coding is an efficient tool for exploiting the redundancy of symbols to transmit. It is usually used in transform-based coding after the quantization of the spectral lines. By exploiting an a priori probability distribution, the quantized values can be losslessly coded with a reduced number of bits. The principle lies in generating codewords for which the length is function of the symbol probability.
The bit consumption is usually only known after writing the entropy coded symbols into the bit stream. It is usually problematic when optimizing the quantization stage, which needs to know the bit consumption for optimizing the rate distortion function. It is even more problematic when the bit stream has to have a constant size per frame, also known as constant bitrate, which is a requirement for most of the communication network protocols.
In a transform encoder, a set of scale factors defines usually the quantization, by shaping the quantization noise in frequency domain. The noise shaping is function of both the perceived distortion, usually given by a psychoacoustic model, and the engendered bit consumption.
However the last factor is usually only known after fixing the quantization noise shaping. An optimization loop can be used for making the optimization converged. Nevertheless such an optimization is relatively complex and the number of iterations has to be strongly limited in real applications. Moreover for reducing even more the complexity, the bit consumption is usually not fully computed but only estimated. If the final bit consumption is underestimated, the bit-stream will have to be truncated, which is avoided most of the time. Indeed an underestimation will lead to a hard truncation of the bit stream, which is equivalent to make the quantization saturate. Thus, the quantization optimization is usually designed to over-estimate the bit consumption. As a consequence few bits are often unexploited in the final bit stream.
To overcome this problem, a residual (or second) quantization stage can be added after the first quantization stage for exploiting eventual unused bits. These remaining bits then can be used to refine the quantization noise. This principle is explained in the following.
FIG. 10 shows a block diagram of a transform encoder 10. The transform encoder 10 comprises a first quantization stage 12, a residual quantization stage 14, an entropy encoder 16, an entropy coding bit estimation unit 18, a multiplexer 20 and a transformation unit 22.
The transformation unit 22 is configured to transform an input signal from a time domain into a frequency domain. The first quantization stage 12 is configured to quantize the input signal in the frequency domain into a plurality of quantized spectral values q. The plurality of quantized spectral values q, the input signal in the frequency domain x and a number of remaining bits are input to the residual (or second) quantization stage 14 that is configured to refine the output of the first quantization stage 12 and to provide a plurality of quantized residual values qr. The entropy encoder 16 is configured to entropy encode the plurality of quantized spectral values q in order to obtain a plurality of entropy encoded values e. The multiplexer 20 is configured to multiplex the plurality of entropy encoded values e, the scale factors in dependence on an information provided by the first quantization stage 14 and the plurality of quantized residual values delivered by the second quantization 16 in order to obtain a bit stream.
The transform encoder 10 shown in FIG. 10 is designed for delivering a certain target number of bits per frame. The quantization will be adjusted for reaching this target, but for complexity reasons only an estimation of the entropy encoder bit consumption is done when adjusting the quantization steps. Moreover even if the bit estimation is very accurate it may be impossible to find a set of scale factors which lead to the expected target bits. After the first quantization stage 12, quantized values q are entropy coded. The remaining unexploited bits are then allocated to the residual quantization which will refine the output of the first quantization stage 12. The residual quantization stage 14 takes as input the quantized spectral values q, the original spectral values x and a number of remaining bits. The number of remaining bits can be an estimate or the true number of remaining bits. The estimate is usually used when a local synthesis is necessitated at the encoder side for taking for example a switching decision in a closed-loop decision fashion as it is done in AMR-WB+ (Adaptive Multi-Rate Wide Band Extended). In that case, the residual coding has to be called before the eventual call of the entropy encoder 16.
In a common transform encoder 10, the residual quantization stage 14 performs a simple uniform scalar quantization of the difference of an inverse quantized input signal obtained by inverse quantizing the quantized spectral values and the original input signal. However, through rate-distortion performance analysis, it is known that the uniform quantization is only optimal for memoryless and uniformly distributed sources.